#ifndef  __FOC_H
#define  __FOC_H

#include <stdint.h>

#define angle_to_raw 0.017453292519f

extern uint16_t Real_Angle;
extern float Real_raw;
extern float shaft_angle;
extern float Target_Location;
extern volatile float Target_Speed;

float my_abs(float a);
void FOC_Init(void);

float Constrain(float amt, float low, float high);
float Angle_Constrain(float angle);
float Get_Electric_Angle();
void Set_PWM(float Ua, float Ub, float Uc);
void Set_Phase_Voltage(float Uq, float Ud, float angle_el);
float velocityOpenLoop(float target_velocity, float Uq);
void Set_Velocity(float Target);
void Speed_Velocity(float Target_Speed);
float simple_pid(float error,float kp, float ki, float kd);


#endif 
